﻿using UnityEngine;
using System.Collections;

public class WheelAni : MonoBehaviour {
    float z,a;
    [SerializeField]
    private AudioClip soundClip;
	private GameManager manager=GameManager.getInstance();
	[SerializeField]
    private GameObject stop_button, BoosterWheel;
    public static float i=2;
	void Update (){
         if (manager.Wheel){
                z -= 2;
                BoosterWheel.transform.rotation = Quaternion.Euler(transform.rotation.x, transform.rotation.y, z);
		}else{
              if (i > 0){
                    i -= 0.001f;
                    z -= i;
                    BoosterWheel.transform.rotation = Quaternion.Euler(transform.rotation.x, transform.rotation.y, z);
                }
		}
    }    
    private void clickStop(){
        if (manager.Sound)
        {
            playSound();
        }
		manager.Wheel=false;
		stop_button.collider.enabled=false;
    }
    void playSound()
    {
        audio.clip = soundClip;
        audio.Play();
    }
}
